/*
 * Notifier.cpp
 *
 *  Created on: Nov 13, 2011
 *      Author: gonzalo
 */

#include "Notifier.h"

Notifier::Notifier(void* engine,ColaMensajesSDL* msgExternosASdl) {
	this->recopilados = new ColaMensajesSDL(this);
	this->sdlEvents = new SdlEventsReader(recopilados,engine);
	this->msgExternosReader = new ColaToColaReader(msgExternosASdl,recopilados);

	this->engine = engine;
}

void Notifier::start(){
	this->sdlEvents->start();
	this->msgExternosReader->start();
}

Notifier::~Notifier() {
	delete recopilados;
	delete sdlEvents;
	delete msgExternosReader;

}

bool Notifier::hasEvents(){
	return this->recopilados->hasEvents();
}

void Notifier::terminar(){
	this->msgExternosReader->terminar();
	this->recopilados->terminar();
	this->sdlEvents->terminar();
}

Event* Notifier::pullEvent() {
	return recopilados->getEvent();
}
